package com.wtwd.campus.fjryE15.entity.dto;

import com.alibaba.fastjson.JSONObject;
import com.wtwd.campus.fjryE15.entity.PhoneData;
import com.wtwd.campus.fjryE15.untils.XyyUtiils;
import com.wtwd.campus.wx.utils.AESUtils;
import org.apache.commons.lang.StringUtils;

import java.util.List;

/**
 * @author mjy(亲情号码 、 白名单 、 sos号码设置)
 * 1.sos号码最大设置3个,对应号码键位1-3
 * 2.亲情号最大设置3个，4-6
 * 3.白名单号码最大设置17组对应7-24
 * @date 2022/09/19
 * @description
 */
public class SetSpecialNumDto {

    private String appId;

    private String time;

    private String randomStr;

    private String sign;

    private String imei;

    private String sosList;

    private String familyList;

    private String whiteList;

    private List<PhoneData> sosLists;

    private List<PhoneData> familyLists;

    private List<PhoneData> whiteLists;

    public List<PhoneData> getSosLists() {
        if (StringUtils.isNotBlank(sosList)) {
            return JSONObject.parseArray(AESUtils.deCode(sosList, XyyUtiils.APP_KEY), PhoneData.class);
        }
        return sosLists;
    }

    public List<PhoneData> getFamilyLists() {
        if (StringUtils.isNotBlank(familyList)) {
            return JSONObject.parseArray(AESUtils.deCode(familyList, XyyUtiils.APP_KEY), PhoneData.class);
        }
        return familyLists;
    }

    public List<PhoneData> getWhiteLists() {
        if (StringUtils.isNotBlank(whiteList)) {
            return JSONObject.parseArray(AESUtils.deCode(whiteList, XyyUtiils.APP_KEY), PhoneData.class);
        }
        return whiteLists;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getImei() {
        if (StringUtils.isNotBlank(imei)){
            return AESUtils.deCode(imei,XyyUtiils.APP_KEY);
        }
        return imei;
    }

    public String getRandomStr() {
        return randomStr;
    }

    public void setRandomStr(String randomStr) {
        this.randomStr = randomStr;
    }

    public String getSosList() {
        return sosList;
    }

    public void setSosList(String sosList) {
        this.sosList = sosList;
    }

    public String getFamilyList() {
        return familyList;
    }

    public void setFamilyList(String familyList) {
        this.familyList = familyList;
    }

    public String getWhiteList() {
        return whiteList;
    }

    public void setWhiteList(String whiteList) {
        this.whiteList = whiteList;
    }




}
